package com.gitee.paymenthystrix.controller;

import com.gitee.paymenthystrix.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName PaymentController
 * @Description TODO
 * @Author xiongchao
 * @Date 2020/12/21 9:58
 **/
@RestController
public class PaymentController {

    @Autowired
    private PaymentService service;

    @Value("${server.port}")
    private String port;


    @GetMapping("/hystrix/ok/{id}")
    public String paymentOk(@PathVariable("id") Integer id){
        return service.paymentOk(id);
    }

    @GetMapping("/hystrix/timeout/{id}")
    public String paymentTimeOut(@PathVariable("id") Integer id){
        return service.paymentTimeout(id);
    }
}
